Repository navigation
fix(common): MeshValue.eq returns true when the other value has extra units - #876
Merged
Merged
Conversation
…nits Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
twwu123
approved these changes
Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MeshValue.eqonly walks the units of the left side so a value that is a subset of the other one compares as equal.new MeshValue({ lovelace: 20n }).eq(new MeshValue({ lovelace: 20n, [unit]: 10n }))returns true and an empty value equals anything.TxTester.inputsValueandoutputsValueuseeqso they can pass when the expected value has assets the tx does not carry.Added a unit count check before the per unit comparison. There were no tests for
eqso I added a few next to thegeqandleqones. Two of them fail on main and pass now.Affect components
@meshsdk/common@meshsdk/contract@meshsdk/core@meshsdk/core-csl@meshsdk/core-cst@meshsdk/hydra@meshsdk/provider@meshsdk/react@meshsdk/svelte@meshsdk/transaction@meshsdk/walletType of Change
Related Issues
None that I could find.
Checklist
npm run test)npm run build)Additional Information
I ran the
@meshsdk/commonjest suite after building common, core-csl, core-cst, transaction, wallet and core withbuild:mesh. 22 suites and 206 tests pass including the tx-tester one. I did not run the other packages' suites or the full turbo build.🤖 Generated with Claude Code